home *** CD-ROM | disk | FTP | other *** search
/ Light ROM 1 / LIGHT-ROM 1 (Amiga Library Services)(1994).iso / ffdisks / d998.lha / TeXPrt / source / BuildGUI.c next >
C/C++ Source or Header  |  1994-04-05  |  22KB  |  524 lines

  1. /***************************************************************************
  2.  *                                                                         *
  3.  *  Filename : BuildGUI.c                                                  *
  4.  *                                                                         *
  5.  *  Description : Routines for creating the program's GUI.                 *
  6.  *                                                                         *
  7.  ***************************************************************************
  8.  *                                                                         *
  9.  *                         Modification History                            *
  10.  *                                                                         *
  11.  *  Date      Author       Comments                                        *
  12.  * ----------------------------------------------------------------------  *
  13.  * 10.6.93    R.Bödi       Created.                                        *
  14.  * 2.11.93    R.Bödi       Changed structure TeXDriver, see TeXPrt.h       *
  15.  * 21.2.94    R.Bödi       Changed GUI building to MUI.                    *
  16.  * 22.2.94    R.Bödi       Added AppMsgFunc() hook function for appwindow  *
  17.  *                         message handling.                               *
  18.  *                                                                         *
  19.  ***************************************************************************
  20.  *                                                                         *
  21.  * Copyright © 1993 Richard Bödi,  All rights reserved.                    *
  22.  *                                                                         *
  23.  ***************************************************************************/
  24.  
  25. /*----------------------------- INCLUDES ----------------------------------*/
  26.  
  27. #include "TeXPrt.h"
  28. #include "TexPrt_protos.h"
  29. #include "TexPrt_globals.h"
  30.  
  31. /*----------------------------- DEFINES -----------------------------------*/
  32.  
  33. #define MAKE_ID(a,b,c,d)    \
  34.     ((ULONG) (a)<<24 | (ULONG) (b)<<16 | (ULONG) (c)<<8 | (ULONG) (d))
  35.  
  36. /*-------------------------- GLOBAL DATA ----------------------------------*/
  37.  
  38. static char    *STR_RAD_FromTo [] =     {     "Whole text",     "From/To",     NULL     };
  39. static char    *STR_RAD_OddEven [] =     {     "All",     "Odd",     "Even",     NULL     };
  40. static char    *STR_RAD_Orientation [] =     {     "Portrait",     "Landscape",     NULL     };
  41.  
  42. static const struct Hook AppMsgHook = { { NULL,NULL },(void *)AppMsgFunc,NULL,NULL };
  43.  
  44. /*------------------------------- CODE ------------------------------------*/
  45.  
  46. /***************************************************************************
  47.  *                                                                         *
  48.  *  Function name : AppMsgFunc                                             *
  49.  *                                                                         *
  50.  *  Description : App message callback hook which is called when an icon   *
  51.  *                is dropped on an MUI object.                             *
  52.  *                                                                         *
  53.  ***************************************************************************
  54.  *                                                                         *
  55.  *  Synopsis : AppMsgFunc (Object, AppMessage)                             *
  56.  *                                                                         *
  57.  *  Parameters :                                                           *
  58.  *    (APTR) Object:                                                       *
  59.  *       The MUI object which is affected by dropping the icon onto.       *
  60.  *    (struct AppMessage **) AppMsg:                                       *
  61.  *       The message from the icon which has beedn dropped on the object.  *
  62.  *                                                                         *
  63.  *  Return value : None                                                    *
  64.  *                                                                         *
  65.  ***************************************************************************/
  66.  
  67. void __saveds __asm AppMsgFunc (register __a2 APTR Object, register __a1 struct AppMessage **AppMsg)
  68.  
  69. {
  70. int i;
  71. struct WBArg        *WBArg;
  72. struct AppMessage   *TempAppMsg = *AppMsg;
  73. static char          Buffer[FMSIZE];
  74.  
  75. for (WBArg = TempAppMsg->am_ArgList, i = 0; i < TempAppMsg->am_NumArgs; i++, WBArg++)
  76.    {
  77.     NameFromLock (WBArg->wa_Lock, Buffer, sizeof (Buffer));
  78.     AddPart (Buffer, WBArg->wa_Name, sizeof (Buffer));
  79.    SetAttrs(Object, MUIA_String_Contents, Buffer, TAG_DONE);
  80.    }
  81. }
  82.  
  83.  
  84. /***************************************************************************
  85.  *                                                                         *
  86.  *  Function name : BuildMUIApp                                            *
  87.  *                                                                         *
  88.  *  Description : Creates the MUI GUI.                                     *
  89.  *                                                                         *
  90.  ***************************************************************************
  91.  *                                                                         *
  92.  *  Synopsis : BuildMUIApp (Pointers)                                      *
  93.  *                                                                         *
  94.  *  Parameters :                                                           *
  95.  *    (struct MUIPointers *) Pointers:                                     *
  96.  *       A structure consisting of APTRs to MUI elements.                  *
  97.  *    (struct NewMenu *) Menu:                                             *
  98.  *       The window's menu.                                                *
  99.  *                                                                         *
  100.  *  Return value : (BOOL)                                                  *
  101.  *      TRUE, if successful,                                               *
  102.  *     FALSE, if not.                                                      *
  103.  *                                                                         *
  104.  ***************************************************************************/
  105.  
  106. BOOL  BuildMUIApp (struct MUIPointers *Pointers, struct NewMenu *Menu)
  107.  
  108. {
  109. Pointers->app = ApplicationObject,
  110.     MUIA_Application_Author, "Richard A. Bödi",
  111.     MUIA_Application_Base, AppName,
  112.     MUIA_Application_Title, AppName,
  113.     MUIA_Application_Version, Version,
  114.     MUIA_Application_Copyright, "© 1994 Richard A. Bödi",
  115.     MUIA_Application_Description, "A front end for DVI printer drivers",
  116.    MUIA_Application_Commands, ARexxCommandList,
  117.     MUIA_Application_Menu, Menu,
  118.     SubWindow, Pointers->MainWindow = WindowObject,
  119.         MUIA_Window_Title, &Version[6],
  120.         MUIA_Window_ID, (ULONG)(MAKE_ID ('T','e','X','P')),
  121.        MUIA_Window_AppWindow, TRUE,
  122.         MUIA_HelpNode, "MainWindow",
  123.         WindowContents, GroupObject,
  124.             MUIA_Group_Horiz, 1,
  125.             MUIA_Group_HorizSpacing, 10,
  126.             MUIA_Group_VertSpacing, 10,
  127.             Child, GroupObject,
  128.                 Child, GroupObject,
  129.                     GroupFrameT( "I/O" ),
  130.                     Child, GroupObject,
  131.                         MUIA_Group_Horiz, 1,
  132.                         Child, ColGroup( 2 ),
  133.                             Child, KeyLabel2("DVI File",'D'),
  134.                           Child, Pointers->IMG_In = PopaslObject,
  135.                               MUIA_Popstring_String, Pointers->STR_DVIFile = KeyString("",FMSIZE,'d'),
  136.                               MUIA_Popstring_Button, PopButton(MUII_PopFile),
  137.                               ASLFR_TitleText, "Please select a DVI file...",
  138.                               End,
  139.                         End,
  140.                     End,
  141.                     Child, GroupObject,
  142.                         MUIA_Group_Horiz, 1,
  143.                         Child, ColGroup( 2 ),
  144.                             Child, KeyLabel2( "Output to",'O' ),
  145.                           Child, Pointers->IMG_Out = PopaslObject,
  146.                               MUIA_Popstring_String, Pointers->STR_OutFile = KeyString("",FMSIZE,'o'),
  147.                               MUIA_Popstring_Button, PopButton(MUII_PopFile),
  148.                               ASLFR_TitleText, "Please select an output file or a device...",
  149.                               End,
  150.                         End,
  151.                     End,
  152.                 End,
  153.                 Child, GroupObject,
  154.                     GroupFrameT( "Page Selection" ),
  155.                     MUIA_Group_Horiz, 1,
  156.                     Child, GroupObject,
  157.                         Child, Pointers->RAD_FromTo = RadioObject,
  158.                             GroupFrameT( "" ),
  159.                             MUIA_Radio_Entries, STR_RAD_FromTo,
  160.                         End,
  161.                         Child, ColGroup( 2 ),
  162.                             Child, KeyLabel2( "From",'F' ),
  163.                             Child, Pointers->STR_From = StringObject,
  164.                                 StringFrame,
  165.                                 MUIA_ControlChar, 'f',
  166.                                 MUIA_String_Contents, "1",
  167.                                 MUIA_String_Accept, "-0123456789",
  168.                                 MUIA_String_Format, 2,
  169.                             End,
  170.                         End,
  171.                         Child, ColGroup( 2 ),
  172.                             Child, KeyLabel2( "  To",'T' ),
  173.                             Child, Pointers->STR_To = StringObject,
  174.                                 StringFrame,
  175.                                 MUIA_ControlChar, 't',
  176.                                 MUIA_String_Contents, "1",
  177.                                 MUIA_String_Accept, "-0123456789",
  178.                                 MUIA_String_Format, 2,
  179.                             End,
  180.                         End,
  181.                     End,
  182.                     Child, HVSpace,
  183.                     Child, GroupObject,
  184.                         Child, Pointers->RAD_OddEven = RadioObject,
  185.                             GroupFrameT( "" ),
  186.                             MUIA_Radio_Entries, STR_RAD_OddEven,
  187.                         End,
  188.                         Child, HVSpace,
  189.                         Child, ColGroup( 2 ),
  190.                             Child, KeyLabel2( "Copies",'C' ),
  191.                             Child, Pointers->STR_Copies = StringObject,
  192.                                 StringFrame,
  193.                                 MUIA_ControlChar, 'c',
  194.                                 MUIA_String_Contents, "1",
  195.                                 MUIA_String_Accept, "0123456789",
  196.                                 MUIA_String_Format, 2,
  197.                             End,
  198.                         End,
  199.                     End,
  200.                 End,
  201.                 Child, GroupObject,
  202.                     GroupFrameT( "Page Setup" ),
  203.                     MUIA_Group_Horiz, 1,
  204.                     Child, GroupObject,
  205.                         Child, Pointers->RAD_Orientation = RadioObject,
  206.                             GroupFrameT( "Orientation" ),
  207.                             MUIA_Radio_Entries, STR_RAD_Orientation,
  208.                         End,
  209.                         Child, HVSpace,
  210.                     End,
  211.                     Child, GroupObject,
  212.                         GroupFrameT( "Offsets" ),
  213.                         Child, GroupObject,
  214.                             MUIA_Group_Horiz, 1,
  215.                             Child, ColGroup( 2 ),
  216.                                 Child, KeyLabel2( "X",'X' ),
  217.                                 Child, Pointers->STR_X = StringObject,
  218.                                     StringFrame,
  219.                                     MUIA_ControlChar, 'x',
  220.                                     MUIA_String_Contents, "0",
  221.                                     MUIA_String_Accept, "-0123456789",
  222.                                     MUIA_String_Format, 2,
  223.                                 End,
  224.                             End,
  225.                             Child, Pointers->TXT_X = TextObject,
  226.                                 MUIA_Background, 128,
  227.                                 MUIA_Text_SetMax, 1,
  228.                                 MUIA_Text_SetMin, 1,
  229.                                 MUIA_Frame, 0,
  230.                             End,
  231.                         End,
  232.                         Child, GroupObject,
  233.                             MUIA_Group_Horiz, 1,
  234.                             Child, ColGroup( 2 ),
  235.                                 Child, KeyLabel2( "Y",'Y' ),
  236.                                 Child, Pointers->STR_Y = StringObject,
  237.                                     StringFrame,
  238.                                     MUIA_ControlChar, 'y',
  239.                                     MUIA_String_Contents, "0",
  240.                                     MUIA_String_Accept, "-0123456789",
  241.                                     MUIA_String_Format, 2,
  242.                                 End,
  243.                             End,
  244.                             Child, Pointers->TXT_Y = TextObject,
  245.                                 MUIA_Background, 128,
  246.                                 MUIA_Text_SetMax, 1,
  247.                                 MUIA_Text_SetMin, 1,
  248.                                 MUIA_Frame, 0,
  249.                             End,
  250.                         End,
  251.                     End,
  252.                 End,
  253.             End,
  254.             Child, GroupObject,
  255.                 Child, GroupObject,
  256.                     GroupFrameT( "Options" ),
  257.                     MUIA_Group_Horiz, 1,
  258.                     Child, GroupObject,
  259.                         MUIA_Group_VertSpacing, 2,
  260.                         Child, Pointers->CHM_Option[0] = CheckMark( 0 ),
  261.                         Child, Pointers->CHM_Option[1] = CheckMark( 0 ),
  262.                         Child, Pointers->CHM_Option[2] = CheckMark( 0 ),
  263.                         Child, Pointers->CHM_Option[3] = CheckMark( 0 ),
  264.                         Child, Pointers->CHM_Option[4] = CheckMark( 0 ),
  265.                         Child, Pointers->CHM_Option[5] = CheckMark( 0 ),
  266.                         Child, Pointers->CHM_Option[6] = CheckMark( 0 ),
  267.                         Child, Pointers->CHM_Option[7] = CheckMark( 0 ),
  268.                         Child, Pointers->CHM_Option[8] = CheckMark( 0 ),
  269.                         Child, Pointers->CHM_Option[9] = CheckMark( 0 ),
  270.                     End,
  271.                     Child, GroupObject,
  272.                         MUIA_Group_VertSpacing, 5,
  273.                         Child, Pointers->TXT_Option[0] = TextObject,
  274.                             MUIA_Background, 128,
  275.                             MUIA_Text_SetMax, 1,
  276.                             MUIA_Text_SetMin, 1,
  277.                             MUIA_Frame, 0,
  278.                         End,
  279.                         Child, Pointers->TXT_Option[1] = TextObject,
  280.                             MUIA_Background, 128,
  281.                             MUIA_Text_SetMax, 1,
  282.                             MUIA_Text_SetMin, 1,
  283.                             MUIA_Frame, 0,
  284.                         End,
  285.                         Child, Pointers->TXT_Option[2] = TextObject,
  286.                             MUIA_Background, 128,
  287.                             MUIA_Text_SetMax, 1,
  288.                             MUIA_Text_SetMin, 1,
  289.                             MUIA_Frame, 0,
  290.                         End,
  291.                         Child, Pointers->TXT_Option[3] = TextObject,
  292.                             MUIA_Background, 128,
  293.                             MUIA_Text_SetMax, 1,
  294.                             MUIA_Text_SetMin, 1,
  295.                             MUIA_Frame, 0,
  296.                         End,
  297.                         Child, Pointers->TXT_Option[4] = TextObject,
  298.                             MUIA_Background, 128,
  299.                             MUIA_Text_SetMax, 1,
  300.                             MUIA_Text_SetMin, 1,
  301.                             MUIA_Frame, 0,
  302.                         End,
  303.                         Child, Pointers->TXT_Option[5] = TextObject,
  304.                             MUIA_Background, 128,
  305.                             MUIA_Text_SetMax, 1,
  306.                             MUIA_Text_SetMin, 1,
  307.                             MUIA_Frame, 0,
  308.                         End,
  309.                         Child, Pointers->TXT_Option[6] = TextObject,
  310.                             MUIA_Background, 128,
  311.                             MUIA_Text_SetMax, 1,
  312.                             MUIA_Text_SetMin, 1,
  313.                             MUIA_Frame, 0,
  314.                         End,
  315.                         Child, Pointers->TXT_Option[7] = TextObject,
  316.                             MUIA_Background, 128,
  317.                             MUIA_Text_SetMax, 1,
  318.                             MUIA_Text_SetMin, 1,
  319.                             MUIA_Frame, 0,
  320.                         End,
  321.                         Child, Pointers->TXT_Option[8] = TextObject,
  322.                             MUIA_Background, 128,
  323.                             MUIA_Text_SetMax, 1,
  324.                             MUIA_Text_SetMin, 1,
  325.                             MUIA_Frame, 0,
  326.                         End,
  327.                         Child, Pointers->TXT_Option[9] = TextObject,
  328.                             MUIA_Background, 128,
  329.                             MUIA_Text_SetMax, 1,
  330.                             MUIA_Text_SetMin, 1,
  331.                             MUIA_Frame, 0,
  332.                         End,
  333.                     End,
  334.                 End,
  335.                 Child, HVSpace,
  336.                 Child, GroupObject,
  337.                     GroupFrameT( "Operate" ),
  338.                     MUIA_Group_Horiz, 1,
  339.                     Child, Pointers->BUT_Quit = KeyButton( "Quit",'q' ),
  340.                     Child, Pointers->BUT_Print = KeyButton( "Print",'p' ),
  341.                 End,
  342.             End,
  343.         End,
  344.     End,
  345. End;
  346.  
  347. // Set callback hook for appwindow
  348. DoMethod (Pointers->MainWindow, MUIM_Notify, MUIA_AppMessage, MUIV_EveryTime,
  349.             Pointers->STR_DVIFile, 3, MUIM_CallHook, &AppMsgHook, MUIV_TriggerValue);
  350. // Set cycle chain for MUI objects
  351. DoMethod (Pointers->MainWindow, MUIM_Window_SetCycleChain,
  352.           Pointers->RAD_FromTo, Pointers->STR_From, Pointers->STR_To,
  353.           Pointers->RAD_OddEven, Pointers->STR_Copies, Pointers->RAD_Orientation,
  354.           Pointers->STR_X, Pointers->STR_Y, NULL);
  355. // Connect the Print and Quit button as well as the closing gadget
  356. DoMethod (Pointers->MainWindow, MUIM_Notify, MUIA_Window_CloseRequest, TRUE, Pointers->app, 2, MUIM_Application_ReturnID, ID_QUIT);
  357. DoMethod (Pointers->STR_From,   MUIM_Notify, MUIA_String_Contents, MUIV_EveryTime, Pointers->app, 2, MUIM_Application_ReturnID, ID_FROM_PAGE);
  358. DoMethod (Pointers->STR_To,     MUIM_Notify, MUIA_String_Contents, MUIV_EveryTime, Pointers->app, 2, MUIM_Application_ReturnID, ID_TO_PAGE);
  359. DoMethod (Pointers->BUT_Print,  MUIM_Notify, MUIA_Pressed, FALSE, Pointers->app, 2, MUIM_Application_ReturnID, ID_PRINT);
  360. DoMethod (Pointers->BUT_Quit,   MUIM_Notify, MUIA_Pressed, FALSE, Pointers->app, 2, MUIM_Application_ReturnID, ID_QUIT);
  361.  
  362. return ((BOOL)(!set (Pointers->MainWindow, MUIA_Window_Open, TRUE)));
  363. }
  364.  
  365.  
  366.  
  367. /***************************************************************************
  368.  *                                                                         *
  369.  *  Function name : BuildMenuStructure                                     *
  370.  *                                                                         *
  371.  *  Description : Allocates and builds a NewMenu structure according to    *
  372.  *                the DVI printer drivers found by ScanDrivers.            *
  373.  *                The environment variable TeXPrint is used to determine   *
  374.  *                the default printer driver.                              *
  375.  *                                                                         *
  376.  ***************************************************************************
  377.  *                                                                         *
  378.  *  Synopsis : BuildMenuStructure (AvailDrivers, NewMenu)                  *
  379.  *                                                                         *
  380.  *  Parameters :                                                           *
  381.  *       (struct AvailDrivers*) AvailDrivers :                             *
  382.  *          Contains the names of the drivers found by ScanDrivers() in    *
  383.  *          the DriverDrawer directory.                                    *
  384.  *       (USHORT *) ActualDriver:                                          *
  385.  *          Will be set to the number of the actual driver file as listed  *
  386.  *          in the Driver menu.                                            *
  387.  *                                                                         *
  388.  *  Return value : (struct NewMenu *)                                      *
  389.  *       Pointer to the NewMenu structure created or NULL if no memory     *
  390.  *       was available.                                                    *
  391.  *                                                                         *
  392.  ***************************************************************************/
  393.  
  394. struct NewMenu   *BuildMenuStructure (struct AvailDrivers *AvailDrivers, USHORT *ActualDriver)
  395.  
  396. {
  397. int             Item;
  398. char            EnvVar[NAMELENGTH];
  399. BOOL            EntryFound = FALSE;
  400. struct NewMenu *NewMenu;
  401.  
  402.  
  403. if (NewMenu = calloc (AvailDrivers->NoOfDrivers + STDITEMS + 2, sizeof (struct NewMenu)))
  404.    {
  405.    NewMenu[0].nm_Type      = NM_TITLE;
  406.    NewMenu[0].nm_Label     = "Config";
  407.    NewMenu[1].nm_Type      = NM_ITEM;
  408.    NewMenu[1].nm_Label     = "Save";
  409.    NewMenu[1].nm_CommKey   = "S";
  410.    NewMenu[1].nm_UserData  = (APTR)ID_SAVE;
  411.    NewMenu[2].nm_Type      = NM_ITEM;
  412.    NewMenu[2].nm_Label     = "Save As";
  413.    NewMenu[2].nm_CommKey   = "A";
  414.    NewMenu[2].nm_UserData  = (APTR)ID_SAVEAS;
  415.    NewMenu[3].nm_Type      = NM_ITEM;
  416.    NewMenu[3].nm_Label     = NM_BARLABEL;
  417.    NewMenu[4].nm_Type      = NM_ITEM;
  418.    NewMenu[4].nm_Label     = "About";
  419.    NewMenu[4].nm_UserData  = (APTR)ID_ABOUT;
  420.    NewMenu[5].nm_Type      = NM_ITEM;
  421.    NewMenu[5].nm_Label     = NM_BARLABEL;
  422.    NewMenu[6].nm_Type      = NM_ITEM;
  423.    NewMenu[6].nm_Label     = "Quit";
  424.    NewMenu[6].nm_CommKey   = "Q";
  425.    NewMenu[6].nm_UserData  = (APTR)ID_QUIT;
  426.    NewMenu[7].nm_Type      = NM_TITLE;
  427.    NewMenu[7].nm_Label     = "Drivers";
  428.  
  429.    GetVar (TeXPrintEnv, EnvVar, sizeof (EnvVar), 0);
  430.    *ActualDriver = 0;
  431.  
  432.    for (Item = 0; Item < AvailDrivers->NoOfDrivers; Item++)
  433.       {
  434.       NewMenu[STDITEMS + 2 + Item].nm_Type           = NM_ITEM;
  435.       NewMenu[STDITEMS + 2 + Item].nm_Label          = AvailDrivers->DriverNames + Item * NAMELENGTH;
  436.       NewMenu[STDITEMS + 2 + Item].nm_Flags         |= CHECKIT;
  437.       NewMenu[STDITEMS + 2 + Item].nm_MutualExclude  = ~(1 << Item);
  438.       NewMenu[STDITEMS + 2 + Item].nm_UserData       = (APTR)(ID_DRIVER + Item);
  439.  
  440.       if ((!strcmp (EnvVar, NewMenu[STDITEMS + 2 + Item].nm_Label)) && (!EntryFound))
  441.          {
  442.          EntryFound = TRUE;
  443.          NewMenu[STDITEMS + 2 + Item].nm_Flags |= CHECKED;
  444.          *ActualDriver = Item;
  445.          }
  446.       }
  447.  
  448.    if (!EntryFound)
  449.       NewMenu[STDITEMS + 2].nm_Flags |= CHECKED;
  450.  
  451.    NewMenu[STDITEMS + 2 + Item].nm_Type = NM_END;
  452.    }
  453.  
  454. return (NewMenu);
  455. }
  456.  
  457.  
  458. /***************************************************************************
  459.  *                                                                         *
  460.  *  Function name : BuildAppIcon                                           *
  461.  *                                                                         *
  462.  *  Description : Creates an AppIcon.                                      *
  463.  *                                                                         *
  464.  ***************************************************************************
  465.  *                                                                         *
  466.  *  Synopsis : BuildAppIcon (AppMsgPort, AppIconObj, AppIcon, IconName)    *
  467.  *                                                                         *
  468.  *  Parameters :                                                           *
  469.  *       (struct MsgPort **) AppMsgPort :                                  *
  470.  *          The message port for arriving notifications on appicons and    *
  471.  *          appwindows.                                                    *
  472.  *       (struct DiskObject **) AppIconObj :                               *
  473.  *          Icon represented as a DiskObject which specifies the appearance*
  474.  *          of the AppIcon. AppIconName is used for the name of the icon   *
  475.  *          file.                                                          *
  476.  *       (struct AppIcon **) AppIcon :                                     *
  477.  *          A pointer to AppIcon structure.                                *
  478.  *          If NULL is supplied, no AppIcon will be created.               *
  479.  *       (char *) IconName :                                               *
  480.  *          A string pointer to the name of the AppIcon.                   *
  481.  *                                                                         *
  482.  *  Return value : (BOOL)                                                  *
  483.  *       TRUE, if the AppIcon has been created.                            *
  484.  *      FALSE, if not.                                                     *
  485.  *                                                                         *
  486.  ***************************************************************************/
  487.  
  488. BOOL  BuildAppIcon (struct MsgPort **AppMsgPort, struct DiskObject **AppIconObj,
  489.                     struct AppIcon **AppIcon, char *IconName)
  490.  
  491. {
  492. BOOL  Created = FALSE;
  493. char  NameNode[FNSIZE];
  494.  
  495. if (*AppMsgPort = (CreateMsgPort ()))
  496.    {
  497.    if (AppIcon)
  498.       {
  499.       if (*AppIconObj = GetDiskObject (IconName))
  500.          {
  501.          (*AppIconObj)->do_Type = NULL;
  502.          (*AppIconObj)->do_CurrentX = NO_ICON_POSITION;
  503.          (*AppIconObj)->do_CurrentY = NO_ICON_POSITION;
  504.  
  505.          stcgfn (NameNode, IconName);
  506.  
  507.          if (*AppIcon = AddAppIconA (0, 0, NameNode, *AppMsgPort, NULL, *AppIconObj, NULL))
  508.             Created = TRUE;
  509.          else
  510.             printf ("Couldn't create AppIcon.\n");
  511.          }
  512.       else
  513.          PrintFault (IoErr (), "Couldn't access icon file for AppIcon.\n");
  514.       }
  515.    }
  516. else
  517.    printf ("Couldn't create message port for AppIcon/AppWindow.\n");
  518.  
  519. return (Created);
  520. }
  521.  
  522.  
  523. /*---------------------------- END OF FILE --------------------------------*/
  524.